//
//  UIDefine.h
//  showjianghu
//
//  Created by 了凡 on 16/2/29.
//  Copyright © 2016年 潘多拉. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface UIDefine : NSObject

float GDDeviceSystemVersion(void);

#ifndef kSystemVersion
#define kSystemVersion GDDeviceSystemVersion()
#endif

//判断是否是苹果X
#define isIphoneX   ((SCREEN_HEIGHT == 812)? YES : NO)
//根据苹果X给导航条高度
#define navHeight   (isIphoneX ? 88 : 64)
#define kIPhoneXBottomHeight (isIphoneX ? 83 :49)
#define kLiu (isIphoneX ? 34 :0)//底部留白

#define kDetail (isIphoneX ? 40 :20)//商品详情顶部Y
//比例
#define bili [UIScreen mainScreen].bounds.size.width/375
//设备号(唯一标示符)
#define kDeviceuUUID [[UIDevice currentDevice].identifierForVendor UUIDString]


//获取屏幕 宽度、高度
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
#define SCALE ([UIScreen mainScreen].scale)

//状态栏、导航栏、标签栏高度
#define STATUS_HEIGHT ([UIApplication sharedApplication].statusBarFrame.size.height)
#define NAVIGATIONBAR_HEIGHT (self.navigationController.navigationBar.frame.size.height)
#define TABBAR_HEIGHT (self.tabBarController.tabBar.frame.size.height)


#define BackgroundColor [UIColor colorWithRed:240/255.0f green:240/255.0f blue:244/255.0f alpha:1]
#define SelectColor        [UIColor colorWithRed:60/255.0f green:0/255.0f blue:132/255.0f alpha:1]
/*
 Create UIColor with a hex string.
 Example: UIColorHex(0xF0F), UIColorHex(66ccff), UIColorHex(#66CCFF88)
 
 Valid format: #RGB #RGBA #RRGGBB #RRGGBBAA 0xRGB ...
 The `#` or "0x" sign is not required.
 */
#ifndef UIColorHex
#define UIColorHex(_hex_)   [UIColor colorWithHexString:((__bridge NSString *)CFSTR(#_hex_))]
#endif

// 颜色的简单构成宏
#define RGB(A, B, C)        [UIColor colorWithRed:A/255.0f green:B/255.0f blue:C/255.0f alpha:1.0f]

//日至输出
#ifdef DEBUG
#define DLog(fmt, ...)      NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#   define DLog(...)
#endif

/**
 Synthsize a weak or strong reference.
 
 Example:
 @weakify(self)
 [self doSomething^{
 @strongify(self)
 if (!self) return;
 ...
 }];
 
 */
#ifndef weakify
#if DEBUG
#if __has_feature(objc_arc)
#define weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object;
#endif
#else
#if __has_feature(objc_arc)
#define weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object;
#endif
#endif
#endif

#ifndef strongify
#if DEBUG
#if __has_feature(objc_arc)
#define strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object;
#endif
#else
#if __has_feature(objc_arc)
#define strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) try{} @finally{} __typeof__(object) object = block##_##object;
#endif
#endif
#endif



#define kBarButtonItem_textColor RGB(100, 100, 100)
#define kRedColor RGB(241, 158, 53)
#define kLightGrayColor RGB(214, 213, 216)
#define kLabelColor RGB(145, 145, 145)
#define kBlackColor RGB(34, 34, 34)
#define kBlueColor RGB(94,187,241)
#define kBackgroudColor RGB(243, 245, 247)
@end
